﻿@using QDT.Common
@using QDT.Core
@using QDT.Core.Deals
@using QDT.MVC.UI
@using QDT.Web
@model QDT.Common.IPagedList<Credit>
@{
    ViewBag.Title = "投资记录";
}
<div class="ui-body">
        <div class="ui-inner">
            <div class="ui-grid-row">

                @Html.Partial("_UserMenu", MenuRoute.InvestRecord )

                <div class="ui-grid-20">
                    <div class="ui-box">
                        
                        <div class="ui-table-container">
                            <table class="ui-table ui-table-inbox thead-ext ui-table-big"><!-- 可以在class中加入ui-table-inbox或ui-table-noborder分别适应不同的情况 -->
                                <thead>
                                    <tr>
                                        <th>投资项目</th>
                                        <th>下个回款日</th>
                                        <th>投资金额</th>
                                        <th>已回收金额</th>
                                        <th>期限</th>
                                        <th>状态</th>
                                        <th>借款协议</th>
                                    </tr>
                                </thead><!-- 表头可选 -->
                                <tbody>
                                    @foreach (var m in Model)
                                    {
                                        var project = Html.F().GetProject(m.ProjectID);
                                        <tr>
                                            <td>
                                                <p><a href="@Url.Action("Index", "Project", new { id=project.ID })">@project.Name</a></p>
                                                <p>@m.CreateTime.ToString("yyyy-MM-dd") 投资</p>
                                            </td>
                                            <td>@(m.NextRepayTime == null ? "-" : m.NextRepayTime.Value.ToString("yyyy-MM-dd"))</td>
                                            <td style="@(m.Money>0?"color:#27ae60":"color: #f39c12")">@m.BuyMoney.ToMoney()@(m.Money > 0 ?  "": "(转)")</td>
                                            <td style="@(m.RepayMoney > 0 ? "color:#27ae60" : "color: #f39c12")">@m.RepayMoney.ToMoney()</td>
                                            <td>@(project.RepayTime)<span>个月</span></td>
                                            <td>
                                                <p><span class="ui-badge @(m.Status == CreditStatus.Completed ? "ui-badge-green" : "ui-badge-orange")">@m.Status.ToLocalizable()</span></p>
                                                <p>已还：@m.CurrentStage / @m.TotalStage</p>
                                            </td>
                                            <td>
                                                @if (m.AssignmentID == 0)
                                                {
                                                    <a href="javascript:;" onclick=" javascript:window.open('/Project/Agreement/@m.ProjectID', '', 'width=1024px;height=768px,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=20,left=20,resizable=no'); ">查看协议<i class="iconfont">&#xf02af;</i></a>
                                                }
                                                else
                                                {
                                                    <a href="javascript:;" onclick=" javascript:window.open('/Assignment/Agreement/@m.AssignmentID', '', 'width=1024px;height=768px,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=20,left=20,resizable=no'); ">查看协议<i class="iconfont">&#xf02af;</i></a>
                                                }
                                            </td>
                                        </tr>
                                    }
                                </tbody>
                            </table>
                        </div>

                        @Html.ClientPager(Model)

                    </div>
                </div>
            </div>
        </div>
    </div>